<%@ Page Language="C#" MasterPageFile="~/Default.master" AutoEventWireup="true" CodeBehind="FilesOverview.aspx.cs" Inherits="MusicmanWeb.FilesOverview" Title="Musicman Levi9 | Overview" %>
<%@ Register Namespace="MusicmanWeb.Custom" TagPrefix="x" Assembly="MusicmanWeb" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Main" runat="server" >

<div class="shim column"></div>

<div class="page" id="home">
    <div id="sidebar">
        <table>
            <tr>
                <td style="width: 50px;">
                    Keywords
                </td>
                <td>
                    <asp:TextBox ID="filename" runat="server" />
                </td>
            </tr>
            <tr>
                <td style="width: 50px;">
                    Type
                </td>
                <td>
                    <asp:DropDownList ID="jobID" runat="server" DataSourceID="ObjectDataSource1" DataValueField="Searchjobid" DataTextField="Name"/>
                </td>
            </tr>
            <tr>
                <td style="width: 50px;">
                    Count
                </td>
                <td>
                    <asp:TextBox ID="Count" runat="server" Width="30"/>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Search" CommandName="Search" BackColor="#333333" ForeColor="#DBB94F" BorderStyle="solid" BorderColor="black" OnCommand="Button2_Click"/>
        <br />
        <br />
        <asp:Button ID="Button2" runat="server" Text="Top downloads" CommandName="Dowlnoads" BackColor="#333333" ForeColor="#DBB94F" BorderStyle="solid" BorderColor="black" OnCommand="Button2_Click"/>
        <br />
        <br />
        <asp:Button ID="Button3" runat="server" Text="Top rated" CommandName="Rating" BackColor="#333333" ForeColor="#DBB94F" BorderStyle="solid" BorderColor="black" OnCommand="Button2_Click"/>
        <br />
        <br />
        <asp:Button ID="Button4" runat="server" Text="Random" CommandName="Random" BackColor="#333333" ForeColor="#DBB94F" BorderStyle="solid" BorderColor="black" OnCommand="Button2_Click"/>
        <br />
        <br />
        <asp:Button ID="Button5" runat="server" Text="Latest" CommandName="Latest" BackColor="#333333" ForeColor="#DBB94F" BorderStyle="solid" BorderColor="black" OnCommand="Button2_Click"/>
        <br />
        <br />
    </div>
    
    <div id="content">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" Width="650">
        <Columns>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="Allcriteria" HeaderText="Allcriteria" SortExpression="Allcriteria" />
            <asp:BoundField DataField="Starttime" HeaderText="Starttime" SortExpression="Starttime" />
            <asp:BoundField DataField="Endtime" HeaderText="Endtime" SortExpression="Endtime" />
            <asp:BoundField DataField="Totalfiles" HeaderText="Totalfiles" SortExpression="Totalfiles" />
            <asp:BoundField DataField="TotalLengthGB" HeaderText="Length" ItemStyle-HorizontalAlign="Right" />
        </Columns>
        </asp:GridView>
        <br />
        <br />
        
        <x:MyGridView runat="server" ID="SearchGV" 
            AutoGenerateCheckBoxColumn="True" 
            AutoGenerateColumns="false"
            DataSourceID="ObjectDataSource2" 
            DataKeyNames="FileID"
            AllowPaging="True" 
            PageSize="15" 
            CheckBoxColumnIndex="5" 
            backcolor="#606060" 
            visible="false" 
            OnDataBound="GridView_DataBound" 
            Width="650px">
            <HeaderStyle BackColor="#333333"  ForeColor="#DBB94F"/>
            <AlternatingRowStyle backcolor="#777777" />
            <SelectedRowStyle BackColor="#CCCCCC" ForeColor="black"/>
            <Columns>
             <asp:BoundField DataField="NameTrimmed" HeaderText="Name" SortExpression="Name" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="350px" />
             <asp:BoundField DataField="TotalLengthMB" HeaderText="Size" ItemStyle-HorizontalAlign="Right" />
             <asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
                <asp:TemplateField>
                <HeaderTemplate>
                    Download
                </HeaderTemplate>
                <ItemTemplate>
                    <a href='GetFile.axd?SEARCHFILEID=<%# Eval("FileID") %>' >download</a>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                <HeaderTemplate>
                    details
                </HeaderTemplate>
                <ItemTemplate>
                    <a href="FileStatsOverview.aspx?Fileid=<%# Eval("FileID") %>" >details</a>
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerTemplate>
            <div style="float:left;">
                Displaying page <asp:Label id="currentPage" runat="server"/> of <asp:Label id="totalPages" runat="server"/> 
            </div>
            <div style="float:right;">
                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="First" Text="<<"/> 
                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="Prev" Text="<"/> 
                <asp:PlaceHolder ID="pages" runat="server">
                <asp:LinkButton ID="Page1" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page2" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page3" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page4" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page5" runat="server" CommandName="Page" />&#160;
                </asp:PlaceHolder>
                <asp:LinkButton runat="server" CommandName="Page" CommandArgument="Next" Text=">"/> 
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Page" CommandArgument="Last" Text=">>"/> 
            </div>
            </PagerTemplate>
        </x:MyGridView>
        
        <x:MyGridView runat="server" ID="TopDownloadsGV" 
                AutoGenerateCheckBoxColumn="True" 
                AutoGenerateColumns="false"
                DataSourceID="ObjectDataSource3" 
                DataKeyNames="FileID"
                AllowPaging="True" 
                PageSize="15" 
                CheckBoxColumnIndex="5" 
                backcolor="#606060" 
                visible="false"
                OnDataBound="GridView_DataBound"
                Width="650px">                
                <HeaderStyle BackColor="#333333"  ForeColor="#DBB94F"/>
                <AlternatingRowStyle backcolor="#777777" />
                <SelectedRowStyle BackColor="#CCCCCC" ForeColor="black"/>
            <Columns>
             <asp:BoundField DataField="NameTrimmed" HeaderText="Name" SortExpression="Name" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="350px" />
             <asp:BoundField DataField="TotalLengthMB" HeaderText="Size" ItemStyle-HorizontalAlign="Right" />
             <asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
                <asp:TemplateField>
                <HeaderTemplate>
                    Download
                </HeaderTemplate>
                <ItemTemplate>
                    <a href='GetFile.axd?SEARCHFILEID=<%# Eval("FileID") %>' >download</a>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                <HeaderTemplate>
                    details
                </HeaderTemplate>
                <ItemTemplate>
                    <a href="FileStatsOverview.aspx?Fileid=<%# Eval("FileID") %>" >details</a>
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerTemplate>
            <div style="float:left;">
                Displaying page <asp:Label id="currentPage" runat="server"/> of <asp:Label id="totalPages" runat="server"/> 
            </div>
            <div style="float:right;">
                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="First" Text="<<"/> 
                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="Prev" Text="<"/> 
                <asp:PlaceHolder ID="pages" runat="server">
                <asp:LinkButton ID="Page1" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page2" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page3" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page4" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page5" runat="server" CommandName="Page" />&#160;
                </asp:PlaceHolder>
                <asp:LinkButton ID="LinkButton5" runat="server" CommandName="Page" CommandArgument="Next" Text=">"/> 
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Page" CommandArgument="Last" Text=">>"/> 
            </div>
            </PagerTemplate>
        </x:MyGridView>

        <x:MyGridView runat="server" ID="TopRatedGV" 
                AutoGenerateCheckBoxColumn="True" 
                AutoGenerateColumns="false"
                DataSourceID="ObjectDataSource4" 
                DataKeyNames="FileID"
                AllowPaging="True" 
                PageSize="15" 
                CheckBoxColumnIndex="5" 
                backcolor="#606060" 
                visible="false"
                OnDataBound="GridView_DataBound"
                Width="650px">                
                <HeaderStyle BackColor="#333333"  ForeColor="#DBB94F"/>
                <AlternatingRowStyle backcolor="#777777" />
                <SelectedRowStyle BackColor="#CCCCCC" ForeColor="black"/>
            <Columns>
             <asp:BoundField DataField="NameTrimmed" HeaderText="Name" SortExpression="Name" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="350px" />
             <asp:BoundField DataField="TotalLengthMB" HeaderText="Size" ItemStyle-HorizontalAlign="Right" />
             <asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
                <asp:TemplateField>
                <HeaderTemplate>
                    Download
                </HeaderTemplate>
                <ItemTemplate>
                    <a href='GetFile.axd?SEARCHFILEID=<%# Eval("FileID") %>' >download</a>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                <HeaderTemplate>
                    details
                </HeaderTemplate>
                <ItemTemplate>
                    <a href="FileStatsOverview.aspx?Fileid=<%# Eval("FileID") %>" >details</a>
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerTemplate>
            <div style="float:left;">
                Displaying page <asp:Label id="currentPage" runat="server"/> of <asp:Label id="totalPages" runat="server"/> 
            </div>
            <div style="float:right;">
                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="First" Text="<<"/> 
                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="Prev" Text="<"/> 
                <asp:PlaceHolder ID="pages" runat="server">
                <asp:LinkButton ID="Page1" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page2" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page3" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page4" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page5" runat="server" CommandName="Page" />&#160;
                </asp:PlaceHolder>
                <asp:LinkButton ID="LinkButton5" runat="server" CommandName="Page" CommandArgument="Next" Text=">"/> 
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Page" CommandArgument="Last" Text=">>"/> 
            </div>
            </PagerTemplate>
        </x:MyGridView>
        
        <x:MyGridView runat="server" ID="RandomGV" 
                AutoGenerateCheckBoxColumn="True" 
                AutoGenerateColumns="false"
                DataSourceID="ObjectDataSource5" 
                DataKeyNames="FileID"
                AllowPaging="True" 
                PageSize="15" 
                CheckBoxColumnIndex="5" 
                backcolor="#606060" 
                visible="false"
                OnDataBound="GridView_DataBound"
                Width="650px">
                <HeaderStyle BackColor="#333333"  ForeColor="#DBB94F"/>
                <AlternatingRowStyle backcolor="#777777" />
                <SelectedRowStyle BackColor="#CCCCCC" ForeColor="black"/>                
            <Columns>
             <asp:BoundField DataField="NameTrimmed" HeaderText="Name" SortExpression="Name" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="350px" />
             <asp:BoundField DataField="TotalLengthMB" HeaderText="Size" ItemStyle-HorizontalAlign="Right" />
             <asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
                <asp:TemplateField>
                <HeaderTemplate>
                    Download
                </HeaderTemplate>
                <ItemTemplate>
                    <a href='GetFile.axd?SEARCHFILEID=<%# Eval("FileID") %>' >download</a>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                <HeaderTemplate>
                    details
                </HeaderTemplate>
                <ItemTemplate>
                    <a href="FileStatsOverview.aspx?Fileid=<%# Eval("FileID") %>" >details</a>
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerTemplate>
            <div style="float:left;">
                Displaying page <asp:Label id="currentPage" runat="server"/> of <asp:Label id="totalPages" runat="server"/> 
            </div>
            <div style="float:right;">
                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="First" Text="<<"/> 
                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="Prev" Text="<"/> 
                <asp:PlaceHolder ID="pages" runat="server">
                <asp:LinkButton ID="Page1" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page2" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page3" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page4" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page5" runat="server" CommandName="Page" />&#160;
                </asp:PlaceHolder>
                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Page" CommandArgument="Next" Text=">"/> 
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Page" CommandArgument="Last" Text=">>"/> 
            </div>
            </PagerTemplate>
        </x:MyGridView>
        <x:MyGridView runat="server" ID="LatestGV" 
                AutoGenerateCheckBoxColumn="True" 
                AutoGenerateColumns="false"
                DataSourceID="ObjectDataSource6" 
                DataKeyNames="FileID"
                AllowPaging="True" 
                PageSize="15" 
                CheckBoxColumnIndex="5" 
                backcolor="#606060" 
                visible="false"
                OnDataBound="GridView_DataBound"
                Width="650px">
                <HeaderStyle BackColor="#333333"  ForeColor="#DBB94F"/>
                <AlternatingRowStyle backcolor="#777777" />
                <SelectedRowStyle BackColor="#CCCCCC" ForeColor="black"/>                
            <Columns>
             <asp:BoundField DataField="NameTrimmed" HeaderText="Name" SortExpression="Name" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="350px" />
             <asp:BoundField DataField="TotalLengthMB" HeaderText="Size" ItemStyle-HorizontalAlign="Right" />
             <asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
                <asp:TemplateField>
                <HeaderTemplate>
                    Download
                </HeaderTemplate>
                <ItemTemplate>
                    <a href='GetFile.axd?SEARCHFILEID=<%# Eval("FileID") %>' >download</a>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                <HeaderTemplate>
                    details
                </HeaderTemplate>
                <ItemTemplate>
                    <a href="FileStatsOverview.aspx?Fileid=<%# Eval("FileID") %>" >details</a>
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerTemplate>
            <div style="float:left;">
                Displaying page <asp:Label id="currentPage" runat="server"/> of <asp:Label id="totalPages" runat="server"/> 
            </div>
            <div style="float:right;">
                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="First" Text="<<"/> 
                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="Prev" Text="<"/> 
                <asp:PlaceHolder ID="pages" runat="server">
                <asp:LinkButton ID="Page1" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page2" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page3" runat="server" CommandName="Page" />&#160;
                <asp:LinkButton ID="Page4" runat="server" CommandName="Page" />&#160; 
                <asp:LinkButton ID="Page5" runat="server" CommandName="Page" />&#160;
                </asp:PlaceHolder>
                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Page" CommandArgument="Next" Text=">"/> 
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Page" CommandArgument="Last" Text=">>"/> 
            </div>
            </PagerTemplate>
        </x:MyGridView>        
                        
        <br />
        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Visible="false"
        Text="Add to downloads" OnClick="UpdateButton_Click"></asp:LinkButton>
        <br />
        <br />
    </div>
</div>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAllSearchJobs" TypeName="Musicman.Business.DataManager" EnableCaching="False"></asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="SearhFiles" TypeName="Musicman.Business.DataManager" EnableCaching="true">
    <SelectParameters>
        <asp:ControlParameter ControlID="jobID" Name="jobID" PropertyName="SelectedValue" Type="Int64"/>
        <asp:ControlParameter ControlID="filename" Name="filename" PropertyName="Text" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
        <asp:ControlParameter ControlID="Count" Name="top" PropertyName="Text" Type="Int32"/>
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource3" runat="server" SelectMethod="GetTopDownloads" TypeName="Musicman.Business.DataManager" EnableCaching="true">
    <SelectParameters>
        <asp:ControlParameter ControlID="jobID" Name="jobID" PropertyName="SelectedValue" Type="Int64"/>
        <asp:ControlParameter ControlID="filename" Name="filename" PropertyName="Text" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
        <asp:ControlParameter ControlID="Count" Name="count" PropertyName="Text" Type="Int32" DefaultValue="50" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource4" runat="server" SelectMethod="GetTopRated" TypeName="Musicman.Business.DataManager" EnableCaching="true">
    <SelectParameters>
        <asp:ControlParameter ControlID="jobID" Name="jobID" PropertyName="SelectedValue" Type="Int64"/>
        <asp:ControlParameter ControlID="filename" Name="filename" PropertyName="Text" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
        <asp:ControlParameter ControlID="Count" Name="count" PropertyName="Text" Type="Int32" DefaultValue="50" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource5" runat="server" SelectMethod="SearchFilesRandom" TypeName="Musicman.Business.DataManager" EnableCaching="true">
    <SelectParameters>
        <asp:ControlParameter ControlID="jobID" Name="jobID" PropertyName="SelectedValue" Type="Int64"/>
        <asp:ControlParameter ControlID="filename" Name="filename" PropertyName="Text" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
        <asp:ControlParameter ControlID="Count" Name="top" PropertyName="Text" Type="Int32" DefaultValue="50" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource6" runat="server" SelectMethod="SearchLatest" TypeName="Musicman.Business.DataManager" EnableCaching="true">
    <SelectParameters>
        <asp:ControlParameter ControlID="jobID" Name="jobID" PropertyName="SelectedValue" Type="Int64"/>
        <asp:ControlParameter ControlID="filename" Name="filename" PropertyName="Text" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
        <asp:ControlParameter ControlID="Count" Name="top" PropertyName="Text" Type="Int32"/>
    </SelectParameters>
</asp:ObjectDataSource>
</asp:Content>
